// pages/addressAdd/addressAdd.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    region:['山东省','青岛市','李沧区'],
    address:{"default": "0", "name": "name", "region": "", "address": "", "receiverName": "", "phone": "" },
  
  },

  formSubmit:function(e){
     console.log('form 提交'+e);
     console.log(e.detail.value);
     var address = new Object;
     address.default = e.detail.value.default;
     address.name = '';
     address.receiverName= e.detail.value.receiverName;
     address.phone = e.detail.value.phone;
     address.region = this.data.region[0]+this.data.region[1]+this.data.region[2];
     address.address = e.detail.value.address;
     var addresses = wx.getStorageSync('addresses');
     addresses = addresses.concat(address);
     wx.setStorageSync('addresses',addresses);
     console.log(address);
     wx.redirectTo({
       url: '/pages/member/address/address',
     })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
  
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})